.character-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
}

.loading-text {
  color: var(--text-color-2);
  font-size: 14px;
}

.empty-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.editor-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.editor-content {
  flex: 1;
  overflow: hidden;
}

.editor-pane {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.editor-input-container {
  position: relative;
  height: 100%;
}

.content-editor {
  height: 100%;
  font-family: inherit;
}

.preview-pane {
  height: 100%;
  padding: 16px;
  overflow-y: auto;
}

.all-characters-pane {
  height: 100%;
  overflow-y: auto;
}

.characters-list-container {
  height: 100%;
}

.characters-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-characters {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  width: 100%;
}

.character-card {
  background: var(--card-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: auto;
  min-height: 200px;
}

.character-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 派系标签样式 */
.faction-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  z-index: 1;
}

/* 删除图标样式 */
.delete-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: rgba(255, 77, 79, 0.1);
  color: #ff4d4f;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2;
}

.delete-icon:hover {
  background-color: rgba(255, 77, 79, 0.2);
  transform: scale(1.1);
}

.delete-icon:active {
  transform: scale(0.95);
}

/* 角色姓名圆形色块 */
.character-name-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  margin-bottom: 12px;
  padding: 0 16px;
}

.character-name-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  background-color: var(--primary-color);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.character-name-text {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  flex-direction: column;
}

.arrow-button {
  background: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 2;
}

.arrow-button:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: scale(1.1);
}

.arrow-button:active {
  transform: scale(0.95);
}

/* 角色信息区域 */
.character-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  width: 100%;
  overflow: hidden;
}

.divider-text {
  font-size: 12px;
  color: var(--n-color-text-3);
  padding: 0 8px;
  white-space: nowrap;
}
.n-divider:not(.n-divider--vertical){
  margin: 0;
}

.character-info-value {
  font-size: 12px;
  color: var(--n-color-text-3);
  line-height: 1.4;
  overflow: visible;
  display: -webkit-box;
  -webkit-line-clamp: unset;
  -webkit-box-orient: vertical;
  word-break: break-word;
  max-width: 100%;
}

.character-actions {
  position: absolute;
  top: 8px;
  left: 8px;
}

/* 派系背景色 */
.faction-正派 {
  background-color: #f6ffed;
  border-color: #b7eb8f;
}
.faction-正派 .character-name-circle {
  background-color: #52c41a;
}
.faction-正派 .faction-tag {
  color: #52c41a;
  background-color: #f6ffed;
  border: 1px solid #b7eb8f;
}

.faction-反派 {
  background-color: #fff2f0;
  border-color: #ffccc7;
}
.faction-反派 .character-name-circle {
  background-color: #ff4d4f;
}
.faction-反派 .faction-tag {
  color: #ff4d4f;
  background-color: #fff2f0;
  border: 1px solid #ffccc7;
}

.faction-同盟 {
  background-color: #f0f5ff;
  border-color: #adc6ff;
}
.faction-同盟 .character-name-circle {
  background-color: #1890ff;
}
.faction-同盟 .faction-tag {
  color: #1890ff;
  background-color: #f0f5ff;
  border: 1px solid #adc6ff;
}

.faction-中立 {
  background-color: #f5f5f5;
  border-color: #d9d9d9;
}
.faction-中立 .character-name-circle {
  background-color: #8c8c8c;
}
.faction-中立 .faction-tag {
  color: #8c8c8c;
  background-color: #f5f5f5;
  border: 1px solid #d9d9d9;
}

.faction-工具人 {
  background-color: #f9f0ff;
  border-color: #d3adf7;
}
.faction-工具人 .character-name-circle {
  background-color: #722ed1;
}
.faction-工具人 .faction-tag {
  color: #722ed1;
  background-color: #f9f0ff;
  border: 1px solid #d3adf7;
}

.faction-墙头草 {
  background-color: #fff7e6;
  border-color: #ffd591;
}
.faction-墙头草 .character-name-circle {
  background-color: #fa8c16;
}
.faction-墙头草 .faction-tag {
  color: #fa8c16;
  background-color: #fff7e6;
  border: 1px solid #ffd591;
}

.faction-路人 {
  background-color: #fafafa;
  border-color: #d9d9d9;
}
.faction-路人 .character-name-circle {
  background-color: #d9d9d9;
}
.faction-路人 .faction-tag {
  color: #d9d9d9;
  background-color: #fafafa;
  border: 1px solid #d9d9d9;
}

.faction-主角 {
  background-color: #e6fffb;
  border-color: #87e8de;
}
.faction-主角 .character-name-circle {
  background-color: #13c2c2;
}
.faction-主角 .faction-tag {
  color: #13c2c2;
  background-color: #e6fffb;
  border: 1px solid #87e8de;
}

.faction-配角 {
  background-color: #fff0f6;
  border-color: #ffadd2;
}
.faction-配角 .character-name-circle {
  background-color: #eb2f96;
}
.faction-配角 .faction-tag {
  color: #eb2f96;
  background-color: #fff0f6;
  border: 1px solid #ffadd2;
}

.faction-未设定派系 {
  background-color: #fafafa;
  border-color: #d9d9d9;
}
.faction-未设定派系 .character-name-circle {
  background-color: #d9d9d9;
}
.faction-未设定派系 .faction-tag {
  color: #d9d9d9;
  background-color: #fafafa;
  border: 1px solid #d9d9d9;
}

/* 示例JSON容器样式 */
.example-json-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-color);
  border-top: 1px solid var(--border-color);
  padding: 16px;
  max-height: 300px;
  overflow: auto;
}

.example-json-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.example-json-content {
  background: var(--code-color);
  border-radius: 4px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-color-1);
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.editor-tabs {
  border-top: 1px solid var(--border-color);
  background: var(--card-color);
}

.loading-overlay-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0; /* 完全覆盖编辑区域 */
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none; /* 允许点击穿透到底部按钮 */
}

/* 编辑器输入容器相对定位，作为遮罩的参考 */
.editor-input-container,
.preview-pane {
  position: relative;
}

/* 解析后的角色卡片网格样式 */
.parsed-characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  align-items: start; /* 改为start，让卡片顶部对齐，而不是拉伸 */
  width: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .characters-grid {
    grid-template-columns: 1fr;
  }
  
  .parsed-characters-grid {
    grid-template-columns: 1fr;
  }
}

/* 自定义滚动条 */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--scrollbar-track-color);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-color);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover-color);
}